package com.example.demo.dao;


import com.example.demo.entity.TxhsVirtualshop;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

public interface XhsDao extends JpaRepository<TxhsVirtualshop, Long> {

    @Modifying
    @Transactional(rollbackFor = {Exception.class})
    @Query(value = "DELETE FROM  t_xhs_virtualshop  WHERE  id= :id ", nativeQuery = true)
    void delectxhsVirtualshop(@Param("id") Integer id);

    @Modifying
    @Transactional(rollbackFor = {Exception.class})
    @Query(value = " insert  INTO  `t_xhs_virtualshop`(`customer_id`, `shop_name`, `be_real`,  `shop_type`) VALUES (:customerId ,:shopName, :beReal,:shopType) ", nativeQuery = true)
    void addXhsvirtualshop(@Param("customerId") String customer_id, @Param("shopName") String shopName, @Param("beReal") int beReal ,  @Param("shopType") String shopType);

}

